package cn.com.shinho.hg.gate.controller;

import cn.com.shinho.hg.core.base.response.ResponseData;
import cn.com.shinho.hg.gate.consumer.AuthServiceConsumer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 登录控制器
 *
 * @author Mr.Ye
 * @Date 2018-6-08-下午7:04
 */
@RestController
@RequestMapping("/authService")
public class LoginController {

    private static  final Log logger = LogFactory.getLog(LoginController.class);

    @Autowired
    private AuthServiceConsumer authServiceConsumer;

//    @RequestMapping("/login")
//    @ResponseBody
//    public Object login() {
//        return LoginContext.me().getUser();
//    }


    @GetMapping("/logout")
    @ResponseBody
    public Object logout() {
        return null;
    }

    @GetMapping("/checkToken/{id}")
    @ResponseBody
    public ResponseData checkToken(@PathVariable("id") Long id) {
        return authServiceConsumer.getUserById(id);
//        logger.info("=========="+id);
//        return SuccessResponseData.success(id);
    }
}
